package exo13;

import exception.MonException;

public class Finally2 {

	public static void f(int n) throws MonException {
		try {
			if (n > 1)
				throw new MonException("catch dans f, n = " + n);
		} catch (MonException except) {
			if (n == 2) {
				System.out.println(except.getMessage());
			}
		} finally {
			System.out.println("dans finally, n = " + n);
		}
	}

	public static void main(String[] args) {
		int n = 0;
		try {
			for (n = 1; n < 5; n++)
				f(n);
		} catch (Exception e) {
			System.out.println("catch dans main - n = " + n);
		} finally {
			System.out.println("dans finally de main - n = " + n);
		}
	}
}
